package com.chi.proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @author chi  2017-06-22 23:13
 **/
public class MyProxy implements InvocationHandler{

    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("经纪人在准备");
        Object invoke = method.invoke(new Star(), args);
        if(method.getName().equals("sing")){
            return "现在是经纪人了";
        }
        System.out.println("经纪人准备完毕");
        return invoke;
    }
}
